<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="./../css/guonei.css">
</head>
<body>
    <header id="header">
        <a href="./../index.html" class="back fl"></a>
        <h4>国内折扣</h4>
        <div class="app fr">
<a href="">
    <img src="./../assets/images/header_app.png" alt="">
</a>
        </div>
    </header>
    <!-- <section id="product">
<ul class="info clearfix">
    <li>
        <a href="">
            <div class="image">
                <img src="" alt="">
            </div>
        </a>
    </li>
</ul>
    </section>    -->
    <ul class="box">
        <li>

        </li>
    </ul>
    </div>    
    <section id="footer">
        <div class="more">
            <a href="">更多优惠信息</a>
        </div>
        <div class="chart">
            <span class="chart_in fl">品牌排行</span>
            <span class="more fr">
                <img src="./../assets/images/more.png" alt="">
            </span>
        </div>
        <div class="login">
            <div class="container">
                <div class="ro">
                    <a href="">
                        <div class="col-xs-3">登入</div>
                    </a>
                    <a href="">
                        <div class="col-xs-4">注册</div>
                    </a>
                    <a href="">
                        <div class="col-xs-5">返回顶部</div>
                    </a>
                    <span></span>
                </div>
            </div>
        <div class="content_b">
            <p>
                <a href="#">
                    手机APP下载
                </a>
                <a href="#">
                    万锋智慧商城手机版
                </a>
                -- 掌上比价平台
            </p>
            <p>
                chst.vip:8081/crm </p>
        </div>
        </div>
            </section>
</body>
<script>
var pr=document.querySelector(".box")
const xhr=new XMLHttpRequest();
xhr.open("get","http://chst.vip:1234/api/getinlanddiscount",true);
xhr.send(null);
   xhr.onreadystatechange = function(){
           if(xhr.readyState === 4){
               if(xhr.status === 200){
                   let res = JSON.parse(xhr.responseText);
                   console.log(res);
                   let regExp = /(?<=imgurl=)[^'"]*/;
                   let ele = "";
                   res.result.forEach(item => {
                       // console.log(item);
                    //    var img = regExp.exec(item.productImg2)[0];
                       ele += `<div productId="${item.productImg}">
                               ${item.productImg}
                               <h5>${item.productName}</h5>
                               <p>${item.productPrice}</p>
                               <span>${item.productTime}</span>
                           </div>`
                   });
                   pr.innerHTML = ele;
               }
           }
       }
</script>
</html>